package cn.funeralobjects.upms.service;

import cn.funeralobjects.common.service.*;
import cn.funeralobjects.upms.BasicInfo;
import cn.funeralobjects.upms.entity.EUserCertificate;
import cn.funeralobjects.upms.enums.UserCertificateType;
import cn.funeralobjects.upms.model.UserCertificate;

import java.util.List;
import java.util.Optional;

/**
 * @author FuneralObjects
 * Create date: 2020/6/3 2:56 PM
 */
public interface UserCertificateService extends CommonModifyService<UserCertificate, EUserCertificate, Integer>,
        EntityService<EUserCertificate, Integer>,
        CodeService<EUserCertificate, Integer>,
        EnableService<EUserCertificate, Integer>,
        DelSaltService<EUserCertificate, Integer>,
        CommitService<Integer>,
        IdService<Integer>,
        ModuleService {

    String ENTITY_NAME = "UserCertificate";

    boolean existsCertificate(String cert, UserCertificateType type);

    boolean existsCertificate(String cert, UserCertificateType type, Integer withoutId);

    Optional<EUserCertificate> findCertificate(String cert, UserCertificateType type);

    List<EUserCertificate> findAllByUserId(Integer userId);

    @Override
    default String getName() {
        return ENTITY_NAME;
    }

    @Override
    default String getModuleName() {
        return BasicInfo.MODULE;
    }
}
